// TypeScript file
module Gold {

    /**
     * 金币跳跃——郭启航
     */
    export class GoldJump {
        /**摧毁一架获得金币*/
        public PlaneGetGold: number = 0;
        /**金币跳跃次数*/
        public JumpNum: number = 0;

        /**每次跳跃增加的金币*/
        public JumpGold: number = 0;
        public goldJump(Type) {
            this.JumpGold = 5;
            this.PlaneGetGold = GameUtil.PlayerMessage.instance.planeConfig[Type].getGold;
            this.JumpNum = this.PlaneGetGold / this.JumpGold;
            var Timer: egret.Timer = new egret.Timer(100, this.JumpNum)
            Timer.addEventListener(egret.TimerEvent.TIMER, this.playGold, this);
            
            if (this.PlaneGetGold > this.JumpNum * this.JumpGold) {
            Timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.PlayGold2, this)
            }
            Timer.start();
        }
        public playGold() {
            GameUtil.PlayerMessage.instance.money += this.JumpGold;
        }
        public PlayGold2() {
            GameUtil.PlayerMessage.instance.money += (this.PlaneGetGold - this.JumpNum * this.JumpGold);
        }      
    }
}